<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <link rel="stylesheet" href="model.css" />
   <?php include("head.php"); ?>
 <?php include("entete.php"); ?>
   <?php include("menu.php"); ?>
<?php

try{
  $pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
  $bdd = new PDO('mysql:host='.DB_SERVER.';dbname='.DB_DATABASE, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, $pdo_options);
  

  $id_personne = $_GET['idPersonne'];
  $id_adherent = $_GET['idAdherent'];
  $nom_personne = $_GET['nomPersonne'];
  $prenom_personne = $_GET['prenomPersonne'];

  $sql = "DELETE FROM PERSONNE WHERE ID_PERSONNE = '$id_personne'";

  $bdd->exec($sql);

  $sql ="DELETE FROM ADHERENT WHERE ID_ADHERENT='$id_adherent'";

  $bdd->exec($sql);

  $sql ="DELETE FROM CONSTITUTION WHERE ID_ADHERENT='$id_adherent'";

  $bdd->exec($sql);

  $sql ="DELETE FROM COTISATION WHERE ID_ADHERENT='$id_adherent'";
  
  $bdd->exec($sql);
  echo $nom_personne.' '.$prenom_personne.' a bien été supprimé';
  /*Il faut revoir la suppression d'un adhérent!!*/
}
catch (Exception $e)
{
  die('Erreur : ' . $e->getMessage());
} 
?>

 <?php include("pied_de_page.php"); ?>

